<template>
<!--子组件-->
  <div>
     <div @click="sendValue('子组件给父组件传的值说')">
       子组件:{{childData}}
     </div>
  </div>
</template>

<script>

export default {
  name: "childCom",
  model: {
    prop: "value",
    event: "change",
  },
  props:{
    value:{
      type:String
    }
  },
  watch:{
    value:{
      handler(newV,oldV){
         console.log("newV:",newV)
         this.childData = newV
      },
      immediate:true,
      deep:true
    }
  },
  created(){
    this.childData = this.value ;
  },
  mounted() {
    console.log("this.value:",this.value)
    this.childData = this.value ;
  },
  data(){
    return{
      childData:'',
    }
  },
  methods:{
    sendValue(value){
      console.log("value:",value)
      this.$emit("change", value);
    },

  }
}
</script>

<style scoped>

</style>